-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Evm a part of the supported virtual machines. #3386
base: main
Are you sure you want to change the base?
Conversation
Integrate the VM type to the BytecodeId.
@@ -47,9 +48,14 @@ pub fn create_dummy_user_application_description( | |||
compressed_bytes: b"service".to_vec(), | |||
}); | |||
|
|||
let vm_runtime = VmRuntime::default(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: just inline the value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done.
@@ -350,6 +351,8 @@ pub struct BytecodeId<Abi = (), Parameters = (), InstantiationArgument = ()> { | |||
pub contract_blob_hash: CryptoHash, | |||
/// The hash of the blob containing the service bytecode. | |||
pub service_blob_hash: CryptoHash, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, if so it would have to be in a separate PR I think.
record bytecode-id { | ||
contract-blob-hash: crypto-hash, | ||
service-blob-hash: crypto-hash, | ||
vm-runtime: vm-runtime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could change. But in another PR.
linera-client/src/client_options.rs
Outdated
@@ -773,6 +774,10 @@ pub enum ClientCommand { | |||
/// Path to the Wasm file for the application "service" bytecode. | |||
service: PathBuf, | |||
|
|||
/// The virtual machine runtime to use. | |||
#[arg(long)] | |||
vm_runtime: Option<VmRuntime>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We could also handle the default here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, thank you.
@@ -1344,19 +1344,6 @@ pub trait WithWasmDefault { | |||
} | |||
|
|||
impl WasmRuntime { | |||
#[cfg(with_wasm_runtime)] | |||
pub fn default_with_sanitizer() -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Is this unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
@MathieuDutSik LGTM. I believe you need to update the summary. Letting someone else accept for good |
Motivation
We extend here the support for EVM. This requires no longer making the virtual machine
a feature of the storage but instead a part of the
BytecodeId
.Proposal
The following changes have been done:
VmRuntime
has been introduced that covers bothWasm
(Native linera) andEvm
.VmRuntime
is added to theBytecodeId
. This is a reasonable way to make the VM a part of the type description.VmRuntime
in theUserApplicationDescription
since this forces thecreate_application
to have aVmRuntime
type. While innocent, this changes is not adequate since thecreate_application
is used in smart contract code and we want to avoid this part to seep into the smart contract code.VmRuntime,
does not depend on any feature. This is because they have to pass the wit barrier and the wit-types cannot depend on features.VmRuntime
has been added to thelinera-base
. This is unavoidable becauseBytecodeId
depends on it.load_contract/load_service
is simplified into one single code that panics when relevant features have not been installed.--vm-runtime
is added to the function calls likepublish_application
. When missing it defaults toVmRuntime::Wasm
.default_with_stabilizer
is eliminated since it is not used.contract_runtime_apis.rs
forApplicationDescription
is corrected.Test Plan
The CI. No test has been added to test the functionality.
Release Plan
Normal release plan.
Links
None.